﻿Public Class m_servicios
    Inherits System.Web.UI.Page

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        seguridad.verificapermisos()
    End Sub

    Protected Sub ImageButton1_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles ImageButton1.Click
        ASPxGridViewExporter1.WritePdfToResponse()
    End Sub

    Protected Sub ImageButton2_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles ImageButton2.Click
        ASPxGridViewExporter1.WriteXlsxToResponse()
    End Sub

    Protected Sub ASPxButton1_Click(ByVal sender As Object, ByVal e As EventArgs) Handles ASPxButton1.Click

        Dim query As String = String.Format("insert into servicios (descripcion) values('{0}')", TextBox1.Text)

        Dim con As New Devart.Data.PostgreSql.PgSqlConnection(seguridad.conexion) ' hacemos la conexion , pero la traemos desde clase seguridad
        con.Open()
        Dim Ejec1 As New Devart.Data.PostgreSql.PgSqlCommand(query, con)

        'Dim registro As Devart.Data.PostgreSql.PgSqlDataReader = Ejec1.ExecuteNonQuery

        Ejec1.ExecuteNonQuery()
        con.Close()
    ASPxGridView1.DataBind()
        TextBox1.Text = ""

    End Sub

    Protected Sub ImageButton3_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles ImageButton3.Click
        Dim sUrl As String = "frmservicios.aspx"
        Dim sScript As String = "<script language =javascript> "
        sScript += "window.open('" & sUrl & "',null,'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=500,height=300,left=100,top=100');"
        sScript += "</script> "
        Response.Write(sScript)
        Dim repot As New rptServicios
        repot.ServiciosTableAdapter.Fill(repot.DataSet11.servicios)
    End Sub
End Class